
const TechSolution = {
    page: 1,
    getSolutionInfo: function (page) {
        let _this = this;
        ajax_get(host + `/ajax/solutionList/${page}`,
            true,
            {},
            (res) => {
                res = JSON.parse(res)
                console.log(res)
                if (res.list && res.list.length > 0)
                    _this.renderHtml(res.list)
                    _this.page = res.page
                    _this.renderPageHtml(res)
            },
            err => {
                console.log(err)
            }
        );
    },
    renderHtml(data) {
        let str = ''
        data.forEach(item => {
            str += `<div class="solution-case wow fadeInUp d2">
            <a href="solution-detail.html?id=${item.id}">
                <div class="solution-img">
                    <img src="${item.image}" alt="">
                </div>
                <div class="solution-title">
                    ${item.title}
                </div>
                <div class="solution-desc">
                    ${item.descript}
                </div>
            </a>
        </div>`
        });
        $(".solution-container").html(str)
    },
    renderPageHtml:function(res){
        let _this = this;
        $('.page-lable-wrap').pagination({
            pageCount: res.page_num,
            current: _this.page,
            coping: true,
            jump: false,
            coping: true,
            homePage: '首页',
            endPage: '末页',
            prevContent: '上页',
            nextContent: '下页',
            callback: function (api) {
                _this.page = api.getCurrent()
                _this.getSolutionInfo(_this.page)
            }
        });

    }
}


$(function () {
    common.init()
    common.getPhoneInfo()
    common.getBanner("solution")
    common.getFootProductCatList()
    common.getFootInfo()
    TechSolution.getSolutionInfo(1)
})